
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html><head><title>Python: module gdata.Crypto.Protocol.AllOrNothing</title>
</head><body bgcolor="#f0f0f8">

<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="heading">
<tr bgcolor="#7799ee">
<td valign=bottom>&nbsp;<br>
<font color="#ffffff" face="helvetica, arial">&nbsp;<br><big><big><strong><a href="gdata.html"><font color="#ffffff">gdata</font></a>.<a href="gdata.Crypto.html"><font color="#ffffff">Crypto</font></a>.<a href="gdata.Crypto.Protocol.html"><font color="#ffffff">Protocol</font></a>.AllOrNothing</strong></big></big></font></td
><td align=right valign=bottom
><font color="#ffffff" face="helvetica, arial"><a href=".">index</a><br><a href="file:/usr/local/lib/python2.6/dist-packages/gdata/Crypto/Protocol/AllOrNothing.py">/usr/local/lib/python2.6/dist-packages/gdata/Crypto/Protocol/AllOrNothing.py</a></font></td></tr></table>
    <p><tt>This&nbsp;file&nbsp;implements&nbsp;all-or-nothing&nbsp;package&nbsp;transformations.<br>
&nbsp;<br>
An&nbsp;all-or-nothing&nbsp;package&nbsp;transformation&nbsp;is&nbsp;one&nbsp;in&nbsp;which&nbsp;some&nbsp;text&nbsp;is<br>
transformed&nbsp;into&nbsp;message&nbsp;blocks,&nbsp;such&nbsp;that&nbsp;all&nbsp;blocks&nbsp;must&nbsp;be&nbsp;obtained&nbsp;before<br>
the&nbsp;reverse&nbsp;transformation&nbsp;can&nbsp;be&nbsp;applied.&nbsp;&nbsp;Thus,&nbsp;if&nbsp;any&nbsp;blocks&nbsp;are&nbsp;corrupted<br>
or&nbsp;lost,&nbsp;the&nbsp;original&nbsp;message&nbsp;cannot&nbsp;be&nbsp;reproduced.<br>
&nbsp;<br>
An&nbsp;all-or-nothing&nbsp;package&nbsp;transformation&nbsp;is&nbsp;not&nbsp;encryption,&nbsp;although&nbsp;a&nbsp;block<br>
cipher&nbsp;algorithm&nbsp;is&nbsp;used.&nbsp;&nbsp;The&nbsp;encryption&nbsp;key&nbsp;is&nbsp;randomly&nbsp;generated&nbsp;and&nbsp;is<br>
extractable&nbsp;from&nbsp;the&nbsp;message&nbsp;blocks.<br>
&nbsp;<br>
This&nbsp;class&nbsp;implements&nbsp;the&nbsp;All-Or-Nothing&nbsp;package&nbsp;transformation&nbsp;algorithm<br>
described&nbsp;in:<br>
&nbsp;<br>
Ronald&nbsp;L.&nbsp;Rivest.&nbsp;&nbsp;"All-Or-Nothing&nbsp;Encryption&nbsp;and&nbsp;The&nbsp;Package&nbsp;Transform"<br>
<a href="http://theory.lcs.mit.edu/~rivest/fusion.pdf">http://theory.lcs.mit.edu/~rivest/fusion.pdf</a></tt></p>
<p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#aa55cc">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Modules</strong></big></font></td></tr>
    
<tr><td bgcolor="#aa55cc"><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td>
<td width="100%"><table width="100%" summary="list"><tr><td width="25%" valign=top><a href="operator.html">operator</a><br>
</td><td width="25%" valign=top><a href="string.html">string</a><br>
</td><td width="25%" valign=top></td><td width="25%" valign=top></td></tr></table></td></tr></table><p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#ee77aa">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Classes</strong></big></font></td></tr>
    
<tr><td bgcolor="#ee77aa"><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td>
<td width="100%"><dl>
<dt><font face="helvetica, arial"><a href="gdata.Crypto.Protocol.AllOrNothing.html#AllOrNothing">AllOrNothing</a>
</font></dt></dl>
 <p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#ffc8d8">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#000000" face="helvetica, arial"><a name="AllOrNothing">class <strong>AllOrNothing</strong></a></font></td></tr>
    
<tr bgcolor="#ffc8d8"><td rowspan=2><tt>&nbsp;&nbsp;&nbsp;</tt></td>
<td colspan=2><tt>Class&nbsp;implementing&nbsp;the&nbsp;All-or-Nothing&nbsp;package&nbsp;transform.<br>
&nbsp;<br>
Methods&nbsp;for&nbsp;subclassing:<br>
&nbsp;<br>
&nbsp;&nbsp;&nbsp;&nbsp;_inventkey(key_size):<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns&nbsp;a&nbsp;randomly&nbsp;generated&nbsp;key.&nbsp;&nbsp;Subclasses&nbsp;can&nbsp;use&nbsp;this&nbsp;to<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;implement&nbsp;better&nbsp;random&nbsp;key&nbsp;generating&nbsp;algorithms.&nbsp;&nbsp;The&nbsp;default<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;algorithm&nbsp;is&nbsp;probably&nbsp;not&nbsp;very&nbsp;cryptographically&nbsp;secure.<br>&nbsp;</tt></td></tr>
<tr><td>&nbsp;</td>
<td width="100%">Methods defined here:<br>
<dl><dt><a name="AllOrNothing-__init__"><strong>__init__</strong></a>(self, ciphermodule, mode<font color="#909090">=None</font>, IV<font color="#909090">=None</font>)</dt><dd><tt><a href="#AllOrNothing">AllOrNothing</a>(ciphermodule,&nbsp;mode=None,&nbsp;IV=None)<br>
&nbsp;<br>
ciphermodule&nbsp;is&nbsp;a&nbsp;module&nbsp;implementing&nbsp;the&nbsp;cipher&nbsp;algorithm&nbsp;to<br>
use.&nbsp;&nbsp;It&nbsp;must&nbsp;provide&nbsp;the&nbsp;<a href="http://www.python.org/dev/peps/pep-0272/">PEP272</a>&nbsp;interface.<br>
&nbsp;<br>
Note&nbsp;that&nbsp;the&nbsp;encryption&nbsp;key&nbsp;is&nbsp;randomly&nbsp;generated<br>
automatically&nbsp;when&nbsp;needed.&nbsp;&nbsp;Optional&nbsp;arguments&nbsp;mode&nbsp;and&nbsp;IV&nbsp;are<br>
passed&nbsp;directly&nbsp;through&nbsp;to&nbsp;the&nbsp;ciphermodule.new()&nbsp;method;&nbsp;they<br>
are&nbsp;the&nbsp;feedback&nbsp;mode&nbsp;and&nbsp;initialization&nbsp;vector&nbsp;to&nbsp;use.&nbsp;&nbsp;All<br>
three&nbsp;arguments&nbsp;must&nbsp;be&nbsp;the&nbsp;same&nbsp;for&nbsp;the&nbsp;object&nbsp;used&nbsp;to&nbsp;create<br>
the&nbsp;digest,&nbsp;and&nbsp;to&nbsp;undigest'ify&nbsp;the&nbsp;message&nbsp;blocks.</tt></dd></dl>

<dl><dt><a name="AllOrNothing-digest"><strong>digest</strong></a>(self, text)</dt><dd><tt><a href="#AllOrNothing-digest">digest</a>(text:string)&nbsp;:&nbsp;[string]<br>
&nbsp;<br>
Perform&nbsp;the&nbsp;All-or-Nothing&nbsp;package&nbsp;transform&nbsp;on&nbsp;the&nbsp;given<br>
string.&nbsp;&nbsp;Output&nbsp;is&nbsp;a&nbsp;list&nbsp;of&nbsp;message&nbsp;blocks&nbsp;describing&nbsp;the<br>
transformed&nbsp;text,&nbsp;where&nbsp;each&nbsp;block&nbsp;is&nbsp;a&nbsp;string&nbsp;of&nbsp;bit&nbsp;length&nbsp;equal<br>
to&nbsp;the&nbsp;ciphermodule's&nbsp;block_size.</tt></dd></dl>

<dl><dt><a name="AllOrNothing-undigest"><strong>undigest</strong></a>(self, blocks)</dt><dd><tt><a href="#AllOrNothing-undigest">undigest</a>(blocks&nbsp;:&nbsp;[string])&nbsp;:&nbsp;string<br>
&nbsp;<br>
Perform&nbsp;the&nbsp;reverse&nbsp;package&nbsp;transformation&nbsp;on&nbsp;a&nbsp;list&nbsp;of&nbsp;message<br>
blocks.&nbsp;&nbsp;Note&nbsp;that&nbsp;the&nbsp;ciphermodule&nbsp;used&nbsp;for&nbsp;both&nbsp;transformations<br>
must&nbsp;be&nbsp;the&nbsp;same.&nbsp;&nbsp;blocks&nbsp;is&nbsp;a&nbsp;list&nbsp;of&nbsp;strings&nbsp;of&nbsp;bit&nbsp;length<br>
equal&nbsp;to&nbsp;the&nbsp;ciphermodule's&nbsp;block_size.</tt></dd></dl>

</td></tr></table></td></tr></table><p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#55aa55">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Data</strong></big></font></td></tr>
    
<tr><td bgcolor="#55aa55"><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td>
<td width="100%"><strong>__revision__</strong> = '$Id: AllOrNothing.py,v 1.8 2003/02/28 15:23:20 akuchling Exp $'</td></tr></table>
</body></html>